import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
import { CreateSpiderDto, getUrlSpiderDto } from './dto/create-spider.dto';
import { UpdateSpiderDto } from './dto/update-spider.dto';
import { SpiderService } from './spider.service';

@Controller('spider')
export class SpiderController {
  constructor(private readonly spiderService: SpiderService) {}

  @Post()
  create(@Body() createSpiderDto: CreateSpiderDto) {
    return this.spiderService.create(createSpiderDto);
  }

  @Post('/urlInfo')
  findUrlInfo(@Body() getUrlSpiderDto:getUrlSpiderDto) {
    return this.spiderService.findUrlInfo(getUrlSpiderDto)
  }

  @Get()
  findAll() {
    return this.spiderService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.spiderService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateSpiderDto: UpdateSpiderDto) {
    return this.spiderService.update(+id, updateSpiderDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.spiderService.remove(+id);
  }
}
